<template>
  <el-table-column
    :key="uuid()"
    header-align="center"
    align="center"
    :width="column.width"
    :prop="column.field"
    :label="column.label"
    :show-overflow-tooltip="column.tip"
  >
    <template slot-scope="scope">
      <template v-if="column.slotName">
        <slot
          :name="column.slotName"
          :index="scope.$index"
          :row="scope.row"
          v-bind="$props"
        />
      </template>
      <template v-else>
        <div>
          {{ scope.row[column.field] }}
        </div>
      </template>
    </template>
    <!--递归子组件-->
    <template v-if="column.children">
      <tree-column v-for="item in column.children" :key="uuid()" :column="item" />
    </template>
  </el-table-column>
</template>

<script>
import { uuid } from '@/utils/util'

export default {
  name: 'TreeColumn',
  props: ['column'],
  data() {
    return {

    }
  },
  created() {
    // console.log(this.$parent)
  },
  methods: {
    uuid
  }
}
</script>

<style scoped>

</style>
